import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import TheCinema from "../views/TheCinema.vue";
import InforMation from "../views/InforMation.vue";
import PersonalCenter from "../views/PersonalCenter.vue";
import TheMovie from "../views/TheMovie.vue";
import TeRelease from "../components/TeRelease.vue";
import TheHit from "../components/TheHit.vue";
import FilmDetails from "../views/FilmDetails.vue";
import MapLocation from "../views/MapLocation.vue";
import LoginPage from "../views/LoginPage.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "",
    redirect: "/movie",
  },
  {
    path: "/movie",
    name: "movie",
    component: TheMovie,
    redirect: "/movie/thehit",
    children: [
      {
        path: "thehit",
        component: TheHit,
      },
      {
        path: "terelease",
        component: TeRelease,
      },
    ],
  },
  {
    path: "/center",
    name: "center",
    component: PersonalCenter,
  },

  {
    path: "/mation",
    name: "mation",
    component: InforMation,
  },

  {
    path: "/cinema",
    name: "cinema",
    component: TheCinema,
  },
  {
    path: "/film/:id",
    name: "film",
    component: FilmDetails,
  },
  {
    path: "/location",
    name: "location",
    component: MapLocation,
  },
  {
    path: "/login",
    name: "login",
    component: LoginPage,
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
